<?php
namespace App\Http\Controllers\Validator;
use Validator;

/**
 * Class ContractVali
 * @package App\Http\Controllers\Validator
 * 合同验证器
 */
class ContractVali{

    public static function validate($params)
    {
        $return = true;
        $validator = Validator::make($params, [
            'number' => 'required',
            'type' => 'required',
            'address' => 'required',
            'price' => 'required',
            'owner_name' => 'required',
            'owner_phone' => 'required',
            'owner_id_number' => 'required',
            'owner_address' => 'required',
            'purpose' => 'required',
            'area' => 'required',
            'status' => 'required',
            'signatory' => 'required',
            'signatory_department' => 'required',
            'signatory_director' => 'required',
            'signatory_director_department' => 'required',
            'customer_name' => 'required',
            'customer_phone' => 'required',
            'customer_address' => 'required',
            'customer_id_number' => 'required',
            'c_contract_time' => 'required'

        ]);
        if ($validator->fails()) {
            $return = false;
        }
        return $return;
    }

    /**
     * @param $params
     * @return bool
     * 诚意金验证器
     */
    public static function validatePrice($params){
        $return = true;
        $validator = Validator::make($params, [
            'e_r_num' => 'required',
            'e_intentional_money' => 'required',
            'e_type' => 'required',
            'e_use_id' => 'required',
            'e_r_address' => 'required',
            'e_status' => 'required',
            'e_owner_name' => 'required',
            'e_owner_phone' => 'required',
            'e_owner_address' => 'required',
            'e_customer_name' => 'required',
            'e_customer_phone' => 'required',
            'e_customer_address' => 'required',
            'e_pay_type'      => 'required',
            'e_d_id'      => 'required',
            'e_uid'      => 'required',
        ]);
        if ($validator->fails()) {
            $return = false;
        }
        return $return;
    }
}